Skip to content

London | 26-ITP-May | Raihan Sharif | Sprint 2 | Coursework#1303

Open
RaihanSharif wants to merge 7 commits intoCodeYourFuture:mainfrom
RaihanSharif:coursework/sprint-2
Open

London | 26-ITP-May | Raihan Sharif | Sprint 2 | Coursework#1303
RaihanSharif wants to merge 7 commits intoCodeYourFuture:mainfrom
RaihanSharif:coursework/sprint-2

Conversation

@RaihanSharif
Copy link
Copy Markdown

Learners, PR Template

Self checklist

  • I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • My changes meet the requirements of the task
  • I have tested my changes
  • My changes follow the style guide

Changelist

Tasks done as per spec. Ran the code to see if it works.

@RaihanSharif RaihanSharif added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. Module-Structuring-And-Testing-Data The name of the module. labels May 6, 2026
Comment thread Sprint-2/3-mandatory-implement/1-bmi.js Outdated
function calculateBMI(weight, height) {
// return the BMI of someone based off their weight and height
} No newline at end of file
return (weight / height ** 2).toFixed(1);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What type of value do you expect your function to return? A number or a string?
Does your function return the type of value you expect?

Different types of values may appear identical in the console output, but they are represented and treated differently in the program. For example,

  console.log(123);              // Output 123
  console.log("123");            // Output 123
  
  // Treated differently in the program
  let sum1 = 123 + 100;         // Evaluate to 223 -- a number
  let sum 2 = "123" + 100;      // Evaluate to "123100" -- a string.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added type conversion to cast string to Number, or return NaN if not possible to cast.

@cjyuan cjyuan added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels May 10, 2026
cast to Number, or return NaN if not posible to do so.
@RaihanSharif RaihanSharif added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. and removed Reviewed Volunteer to add when completing a review with trainee action still to take. labels May 10, 2026
Comment thread Sprint-2/3-mandatory-implement/1-bmi.js Outdated

function calculateBMI(weight, height) {
return (weight / height ** 2).toFixed(1);
return (Number(weight) / Number(height) ** 2).toFixed(1);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How you checked if the return value is a number and not a string after you made the changes?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not. Now it's fixed.

Check the input, convert to Number if possible, else return NaN. Output is a Number.

@cjyuan cjyuan added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels May 10, 2026
@RaihanSharif RaihanSharif added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. and removed Reviewed Volunteer to add when completing a review with trainee action still to take. labels May 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Module-Structuring-And-Testing-Data The name of the module. Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants